package lab02.test11;

public class Square extends Rectangle {
    double length;
    double diagonal;

    double diagonal() {
        diagonal=Math.sqrt(length * length + length * length);
        return diagonal;
    }//求对角线

    @Override
    public void printMyWay() {
        System.out.println("正方形边长为："+length);
        System.out.println("正方形形面积为："+(length*length));
        System.out.println("正方形形周长为："+(2*(length+length)));
        System.out.println("正方形的对角线为："+diagonal);
    }
}
